from utils.others.exceptions import ValueNotFoundError

_cache_configs = {}


class CacheHandler:
    # 缓存池管理
    @staticmethod
    def get_cache(key):
        try:
            return _cache_configs[key]
        except KeyError:
            raise ValueNotFoundError(f'{key}的缓存数据未找到，请检查是否已写入缓存')

    @staticmethod
    def set_cache(*, cache_name, value):
        _cache_configs[cache_name] = value

    @staticmethod
    def get_all_case_id():
        return _cache_configs.keys()